<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/7/16
  Time: 16:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Print</title>
    <base href="/ks_manager/">
    <style type="text/css">
         img{
             height: 1000px;
         }
    </style>
    <link rel="stylesheet" href="static/css/BI.css"/>
    <script type="text/javascript" src="static/js/base.min.js?_v=190102162154"></script>
</head>
<body style="">
<div align="center">
    <input type="button" name="print" value="打印" id="butprint">
</div>
<div style="text-align: center">
    <!--startprint--><img id="image"/><!--endprint-->
</div>
</body>
<script type="text/javascript"<%--src="static/js/page/OperaManager/houseEvaluate/image.js"--%>>
    var header = "Basic " + localStorage.getItem('token')
    var urlHeader = localStorage.getItem('host');
    var proxyHeader = urlHeader + 'manager/shilianProxy.do?url=';
    var url = {
        print: "http://io.worldunion.cn:8620/QueryPrice/PrintInfo/"
    }

    $.ajax({
        url: proxyHeader + encodeURIComponent(url.print + getAurlparam('caseId')),
        //headers: {'Authorization': header},
        dataType:'text',
        data: {token: header},
        crossDomain: true,
        xhrFields: {
            withCredentials: true
        },
        success: function (data) {
            data = JSON.parse(data);
            $("#image").attr('src', 'data:image/jpeg;base64,' + data.content);
        }
    })


    function preview() {
        bdhtml = window.document.body.innerHTML;
        sprnstr = "<!--startprint-->";
        eprnstr = "<!--endprint-->";
        prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
        prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
        //console.log(prnhtml)
        window.document.body.innerHTML = prnhtml;
        console.log(window.document.body.innerHTML)
        window.print();
        window.document.body.innerHTML = bdhtml;
    }

    $("#butprint").on('click',function(){
        preview();
    })
</script>
</html>

